<template>
	<view class="content" :style="app_bg">
		<view class="topTitle" :style="'top:'+zhuangtai+'px'">
			<image class="back" @click="backClick" :src="pubilcPopupImg.btn_back" mode=""></image>
			<view class="" style="font-size: 32rpx;">
				意见反馈
			</view>
		</view>
		<view class="listindex font34" :style="user_margin_top+font_1st">
			<view class="formindex">
				<view class="font30 text1" :style="font_1st_">姓名：</view>
				<input @input="inputusername" v-model="username" class="inputtext" :style="app_border_bg+font_1st" placeholder=" " />
			</view>
			<view class="formindex">
				<view class="font30 text1" :style="font_1st">电话：</view>
				<input @input="inputmobile" v-model="mobile" class="inputtext" :style="app_border_bg+font_1st"  placeholder=" " />
			</view>
			<view class="formindex">
				<view class="font30 text1" :style="font_1st">反馈内容：</view>
				<textarea @input="inputcontent" v-model="textcontent" class="textea" :style="app_border_bg+font_1st" placeholder=" " />
			</view>
			<view class="btn font36 fontw" @click="postop">
				<image class="bgimgpublic" style="z-index: 0;" :src="pubilcPopupImg.btn_lg_warm" mode=""></image>
				<text class=" index-1" :style="font_1st">提交</text>
			</view>
		</view>
		<uni-popup ref="postOptionion" type="center">
			<view class="filesynpopup">
				<view class="filetop" :style="app_border_bg">
					<image :src="pubilcPopupImg.btn_close" mode="" @click="closeFilePopup"></image>
					<text class="font30" :style="font_1st">提示</text>
				</view>
				<view class="filecenter" :style="app_theme">
					<text class="tiptext font30" :style="font_1st">已收到您的反馈，我们会尽快与您联系。</text>
					<view class="btn" @click="closeFilePopup">
						<image class="bgimgpublic" :src="pubilcPopupImg.btn_xs_warm" mode=""></image>
						<text class="font30 index-1" :style="font_1st">确定</text>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	var cssjs = require('@/js/cssjs.js')
	var imagejs = require('@/js/imagejs.js')
	var util = require('@/js/util.js')
	export default {
		data() {
			return {
				publicTextColor:'',
				pubilcPopupImg:'',
				zhuangtai:0,
				textcontent:"",
				moblie:"",
				username:"",
				mobile:""
			};
		},
		onShow() {
			let that = this
			let aniosgaodu = 0
			uni.getSystemInfo({
				success: function(res) {
					console.log(res);
					that.zhuangtai = res.statusBarHeight;
					var a = res.model.split(' ');
					if (a[0] == 'iPhone') {
						aniosgaodu = 44;
					} else {
						aniosgaodu = 48;
					}
					that.zhuangtai = parseInt(that.zhuangtai)+4
					console.log(that.zhuangtai)
				}
			});
		},
		onLoad() {
			this.setcolorConfig()
		},
		computed:{
			user_margin_top(){
				return `margin-top:${(this.zhuangtai+52)}px;background:${this.publicTextColor.app_theme_color};`
			},
			app_border_bg(){
				return `background:${this.publicTextColor.app_border_color};`
			},
			app_theme(){
				return `background:${this.publicTextColor.app_theme_color};`
			},
			app_bg(){
				return `background:${this.publicTextColor.app_bg_color};`
			},
			font_1st(){
				return `color:${this.publicTextColor.font_1st_color};`
			}
		},
		methods:{
			closeFilePopup(){
				this.$refs.postOptionion.close()
			},
			postop(){
				let _self = this
				if(_self.username !="" && _self.mobile!= "" && _self.textcontent!=""){
					if(_self.mobile.length == 11){
						uni.request({
							url: util.getUrl("member/feedback"),
							header: {
								'content-type': 'application/x-www-form-urlencoded',
								'Authori-zation':uni.getStorageSync("token")
							},
							data:{
								username:_self.username,
								mobile:_self.moblie,
								content:_self.textcontent
							},
							method: 'POST',
							success: res => {
								if(res.data.code == 1){
									this.$refs.postOptionion.open()
								}
							},
						});
					}else{
						uni.showToast({
							title:'请输入正确的手机号码',
							icon:'none'
						})
					}
				}else{
					uni.showToast({
						title:'请输入完整的信息',
						icon:'none'
					})
				}
			},
			inputusername(e){
				this.username = e.detail.value
			},
			inputmobile(e){
				this.moblie = e.detail.value
			},
			inputcontent(e){
				this.textcontent = e.detail.value
			},
			setcolorConfig(){
				this.publicTextColor = uni.getStorageSync("diyColor")
				this.pubilcPopupImg = uni.getStorageSync("diyImg")
			},
			backClick(){
				uni.navigateBack({
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.filesynpopup{
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 690rpx;
		border-radius: 20rpx;
		.filecenter{
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 100%;
			padding: 80rpx 0 26rpx 0;
			box-sizing: border-box;
			.tiptext{
				margin-bottom: 66rpx;
				text-align: center;
			}
			.btn{
				width: 209rpx;
				height: 68rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				position: relative;
				image{
					z-index: 0;
				}
			}
		}
		.filetop{
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;
			height: 80rpx;
			width: 100%;
			border-radius: 16rpx 16rpx 0px 0px;
			image{
				position: absolute;
				width: 31rpx;
				height: 31rpx;
				right: 24rpx;
			}
		}
	}
	.listindex{
		box-sizing: border-box;
		width: 690rpx;
		border-radius: 20rpx;
		display: flex;
		justify-content: space-around;
		padding: 42rpx 30rpx 377rpx 30rpx;
		flex-direction: column;
		.btn{
			width: 639rpx;
			height: 88rpx;
			position: relative;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-top: 56rpx;
		}
		.formindex{
			width: 100%;
			display: flex;
			flex-direction: column;
			.text1{
				margin-bottom: 30rpx;
			}
			.inputtext{
				width: 630rpx;
				height: 60rpx;
				margin-bottom: 30rpx;
				border-radius: 8rpx;
				padding: 0 22rpx;
				box-sizing: border-box;
			}
			.textea{
				height: 230rpx;
				width: 100%;
				border-radius: 8rpx;
				padding:22rpx;
				box-sizing: border-box;
			}
		}
	}
	.content{
		min-height: 100vh;
		width: 750rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
	}
	.topTitle{
		color: #FFFFFF;
		display: flex;
		align-items: center;
		height: 67rpx;
		justify-content: center;
		position: absolute;
		z-index: 10;
		width: 100%;
		.back{
			width: 20rpx;
			height: 31rpx;
			position: absolute;
			left: 31rpx;
		}
	}
</style>
